cmake_minimum_required(VERSION 3.6)

project(tinylib)

option(BUILD_DEBUG "whether to build debug version library" OFF)
option(BUILD_RTSP_RTP "whether to build rtsp/rtp library" OFF)
option(BUILD_TEST "whether to build test program" OFF)

set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

include_directories(${PROJECT_SOURCE_DIR})

find_package(OpenSSL)

if (MSVC)
    add_compile_options(
        /utf-8
        /D_CRT_SECURE_NO_WARNINGS
        /D_WINSOCK_DEPRECATED_NO_WARNINGS
    )
elseif (UNIX)
    add_compile_options(
      -Wall
      -Werror
      -ggdb
      -pthread
      -rdynamic
    )
    if (NOT BUILD_DEBUG)
        add_compile_options(-O2 -DNDEBUG)
    endif()
endif()

add_subdirectory(tinylib)

if (BUILD_TEST)
  message(STATUS "Will build test cases")
  add_subdirectory(test)
endif()
